#!/bin/bash

# This is RHCOS only

# kola: { "exclusive": false }
set -xeuo pipefail

ok() {
    echo "ok" "$@"
}

fatal() {
    echo "$@" >&2
    exit 1
}

# Check that we have the proper presets for console-login-helper-messages in RHCOS.
# Versions of CLHM prior to v0.21 have `issuegen`-related systemd units.
if test -f /usr/lib/systemd/system/console-login-helper-messages-issuegen.service; then
  if ! systemctl is-enabled console-login-helper-messages-issuegen.path; then
    fatal "Error: console-login-helper-messages-issuegen.path required but not enabled"
  fi
  if ! systemctl is-enabled console-login-helper-messages-issuegen.service; then
    fatal "Error: console-login-helper-messages-issuegen.service required but not enabled"
  fi
fi
ok "console-login-helper-messages presets present"
